package draft;

import parsing.Constants;


/**
 * 
 * Represents an athlete
 * 
 * @author doug
 */

public class Player implements Comparable<Player> {
	public enum Position { // This is for Yahoo -- ideally XML generated, but w/e
		QB, WR, RB, E, K, DEF, TE
	};
	
	public static final int TOTAL_PLAYERS = 300;
	public final String name;
	public final Position position;
	public int rating;
	public int heuristicRating;
	int team;
	public int positionRating;
	public int byeWeek;
	
	// Used for Minimax search
	boolean visited = false;
	double value; // Value to team if they draft

	
	public Player(String name, Position pos, int rating) {
		this.name = name;
		this.position = pos;
		this.rating = TOTAL_PLAYERS - rating;
	}
	
	public Position getPosition(){
		return position;
	}
	
	
	public int compareTo(Player o) {
		return (int) (rating - o.rating);
	}
	
	public boolean equals (Player o) {
		return o.name.equals(name) && o.position == position && o.rating == rating;
	}
	
	
	public void setTeam(String team){
		for(int i = 0; i < Constants.teams.length; i++){
			if(team.equals(Constants.teams[i])){
				this.team = i;
			}
		}
	}
	
	
	public String getTeam(){
		return Constants.teams[this.team];
	}
	
	
	public String toString(){
		return name + " " + position + " " + rating;
	}
	
	
	public String extendedString(){
		return "Name: " + name + " Team: " + this.getTeam() + " Position: " + this.getPosition() 
			+ " Overall Rank: " + rating + " Position Rank: " + positionRating + " Bye Week: " + byeWeek;
	}
}
